Skip to content

statement-store: add event-fed v2 peer topology#12217

Draft
DenzelPenzel wants to merge 2 commits into
masterfrom
denzelpenzel/statement-v2-peer-topology-events
Draft

statement-store: add event-fed v2 peer topology#12217
DenzelPenzel wants to merge 2 commits into
masterfrom
denzelpenzel/statement-v2-peer-topology-events

Conversation

@DenzelPenzel
Copy link
Copy Markdown
Contributor

@DenzelPenzel DenzelPenzel commented May 27, 2026

Summary

This PR adds the initial statement-store v2 peer topology wiring. #11933

It introduces backend-neutral network events for peer discovery and identify
metadata:

  • Event::PeerDiscovered(PeerId)
  • Event::PeerIdentified { peer, supported_protocols }

Both libp2p and litep2p backends now emit these events from their existing
discovery/routing-table and identify paths.

The statement handler consumes these events and updates a new
PeersTopology module. The topology keeps a local view of statement-capable
peers learned from network discovery, identify metadata, and statement
notification connections.

Design notes

PeersTopology intentionally computes closest peers over the locally learned
peer set. It does not perform topic-specific Kademlia lookups.

The topology currently supports:

  • tracking seen / identified statement-capable peers;
  • tracking statement notification connection state;
  • filtering DHT-eligible peers to full V2 statement peers;
  • computing local DHT storage affinity;
  • selecting K closest connected DHT routing targets;
  • selecting explicit-affinity connection candidates for topics

@DenzelPenzel DenzelPenzel added the T0-node This PR/Issue is related to the topic “node”. label May 27, 2026
@DenzelPenzel DenzelPenzel marked this pull request as draft May 27, 2026 20:28
@DenzelPenzel DenzelPenzel requested a review from alexggh May 27, 2026 20:28
@paritytech-workflow-stopper
Copy link
Copy Markdown

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/26536834946
Failed job name: fmt

@P1sar
Copy link
Copy Markdown
Contributor

P1sar commented Jun 3, 2026

Change the base to feature branch statement-store-dht

#[derive(Debug, Clone, Default)]
struct PeerInfo {
statement_protocol: ProtocolSupport,
dht_eligible: bool,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I am honestly not sure we need this, assuming that ProtocolSupport::Supported is equivalent to dht_eligible = true.
I assume only sutuation when peer support "protocol" but not dht_eligible is when it is a light node. But they should not get in to this flow at all? If it is maybe we should just distinct by the node type {Full, Light}

Comment thread substrate/client/network/src/service.rs Outdated
self.peer_store_handle.add_known_peer(peer_id.into());
let peer = peer_id.into();
self.peer_store_handle.add_known_peer(peer);
self.event_streams.send(Event::PeerDiscovered(peer));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seem that this even bus is very global and used by bunch of parachain subsystems, so I assume even when node is a RelayChain validator it will be receiving all this event although it should not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T0-node This PR/Issue is related to the topic “node”.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants